#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
@File : test2.py
@CreateTime :2021/11/14 19:52 
@Author : 许嘉凯
@Version  : 1.0
@Description : 
"""


class Dog:

    def __init__(self, dog_name, dog_age=1):
        self.name = dog_name
        self.age = dog_age

    def eat(self):
        print("名字是{},年龄{}岁狗狗,在吃东西".format(self.name, self.age))

    def play(self):
        print("名字是{},年龄{}岁狗狗,在玩".format(self.name, self.age))

    def sleep(self):
        print("名字是{},年龄{}岁狗狗,在睡觉".format(self.name, self.age))

    def work(self):
        print("小狗在看守家门")


class Cat:

    def __init__(self, cat_name, cat_age=1):
        self.name = cat_name
        self.age = cat_age

    def eat(self):
        print("名字是{},年龄{}岁猫,在吃东西".format(self.name, self.age))

    def play(self):
        print("名字是{},年龄{}岁猫,在玩".format(self.name, self.age))

    def sleep(self):
        print("名字是{},年龄{}岁猫,在睡觉".format(self.name, self.age))

    def work(self):
        print("小猫开始捉老鼠")


class Person:
    def __init__(self, name, age=1):
        self.name = name
        self.age = age
        self.pet = None

    def eat(self):
        print("我名字是{},年龄{}岁,在吃东西".format(self.name, self.age))

    def play(self):
        print("我名字是{},年龄{}岁,在玩".format(self.name, self.age))

    def sleep(self):
        print("我名字是{},年龄{}岁,在睡觉".format(self.name, self.age))

    def keepAPet(self, pet):
        self.pet = pet
        print("养了一只{}".format(self.pet.name))

    def makePetsWork(self):
        self.pet.work()


dd = Dog("小黑")
fyx = Person("付雅馨", 19)
fyx.keepAPet(dd)
fyx.makePetsWork()
